#include <iostream>
#include <fstream>
#include <locale>
#include "nlohmann/json.hpp"

int main()
{
    // Open the input JSON file
    std::ifstream inputFile("china.json");
    if (!inputFile)
    {
        std::cerr << "Failed to open input file." << std::endl;
        return -1;
    }
    // JSON Resource
    nlohmann::json jsonData;
    inputFile >> jsonData;
    inputFile.close();
    // Open the output JSON file
    std::ofstream outputFile("resource.cpp");
    outputFile.imbue(std::locale("zh_CN.UTF-8 With BOM"));
    if (!outputFile)
    {
        std::cerr << "Failed to open output file." << std::endl;
        return 1;
    }
    outputFile << "#include <iostream>\n";
    outputFile << "#include <locale>\n\n";
    outputFile << "std::wstring JSONResourceData = LR\"(" << jsonData.dump() << ")\";";
    return 0;
}